package com.esri.core.internal.tasks.b;

import com.esri.core.internal.io.handler.h;
import com.esri.core.internal.tasks.TaskListener;
import com.esri.core.io.EsriServiceException;
import com.esri.core.io.UserCredentials;
import com.esri.core.tasks.geodatabase.GenerateGeodatabaseParameters;
import java.net.URI;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.JsonParser;

/* loaded from: classes.dex */
public class c extends com.esri.core.internal.tasks.d<String> {
    private static final long serialVersionUID = 1;

    public c(GenerateGeodatabaseParameters generateGeodatabaseParameters, String str, UserCredentials userCredentials) {
        super(generateGeodatabaseParameters, str, userCredentials);
        if (!generateGeodatabaseParameters.validate()) {
            throw new EsriServiceException("At least one parameter is missing or incorrect. Note that geodatabase extent and layers parameter are required.");
        }
    }

    public c(GenerateGeodatabaseParameters generateGeodatabaseParameters, String str, UserCredentials userCredentials, TaskListener<String> taskListener) {
        super(generateGeodatabaseParameters, str, userCredentials, taskListener);
        if (!generateGeodatabaseParameters.validate()) {
            throw new EsriServiceException("At least one parameter is missing or incorrect. Note that geodatabase extent and layers parameter are required.");
        }
    }

    @Override // com.esri.core.internal.tasks.a
    /* renamed from: a */
    public String execute() throws Exception {
        JsonParser a = h.a(getServiceURL() + "/createReplica", this.actionInput.generateRequestParams(), false, getServiceCredentials());
        JsonNode findValue = com.esri.core.internal.util.d.a().readTree(a).findValue("statusUrl");
        String textValue = findValue != null ? findValue.getTextValue() : "";
        String[] split = new URI(textValue).getPath().split("/");
        a.close();
        return (split == null || split.length <= 0) ? textValue : split[split.length - 1];
    }
}
